﻿using My_LoadPE.Common;
using My_LoadPE.Model.ViewModelBase;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace My_LoadPE.Model
{
    public class ViewModel : Notif
    {

        private ObservableCollection<ObservableCollection<byte>> _ByteList;

        public ObservableCollection<ObservableCollection<byte>> ByteList
        {
            get { return _ByteList; }
            set
            {
                _ByteList = value;
                OnValueChanged();
            }
        }

        public ViewModel()
        {
            getbinnary();
        }
        private async void getbinnary()
        {
            var list = await ReadFile.Instance.BinnaryFile();
            ByteList = new ObservableCollection<ObservableCollection<byte>>();
            ObservableCollection<byte> l2 = new ObservableCollection<byte>();
            for (int i = 0; i < list.Length; i++)
            {
                l2.Add(list[i]);
                if (l2.Count == 16)
                {
                    ByteList.Add(l2);
                    l2 = new ObservableCollection<byte>();
                }
            }
            ByteList.Add(l2);
        }
    }
}
